<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>21-forEach与some的区别</title>
</head>

<body>
  <script>
    let arr = ['red', 'green', 'blue', 'pink']
    /* arr.forEach(function (v) {
      if (v == 'green') {
        console.log('找到了x元素');
        return true;
        console.log('11')
      }
      console.log('22');
    }) */

    arr.some(function (v) {
      if (v == 'green') {
        console.log('找到了x元素');
        // return true;
        console.log('11')
      }
      console.log('22');
    })
  </script>
</body>

</html>